package com.github.xiaolyuh.dataloader;


import com.github.xiaolyuh.entity.CacheValue;
import com.github.xiaolyuh.exception.CacheException;

import java.util.List;
import java.util.Map;

public interface DataLoader<K, T> {

    /**
     * 根据对应的ID获取对应的数据
     *
     * @param id
     * @return
     * @throws CacheException
     */
    public CacheValue<T> get(K id) throws CacheException;

    /**
     * 批量根据对应的ID获取对应的数据
     *
     * @param idList
     * @return
     * @throws CacheException
     */
    public Map<K,CacheValue<T>> batchGet(List<K> idList) throws CacheException;

}
